<?php
class Control_Mailbox extends QUI_Control_Abstract {
    function render() {
        $user = Helper_RBAC::get('user');
        if($this->_attrs['target']=='in')
        {
            $condi = new QDB_Cond(
                '[users.user_id] = ?', $user->user_id
            );
        }
        else {
            $condi = new QDB_Cond(
                'user_id = ?', $user->user_id
            );
        }
        $messages = Message::find($condi)->top(5)->order('created DESC')->query();
        $this->_view['messages'] = $messages;
        return $this->_fetchView('view:' .Q::ini('appini/front/view/style'). '/_control/mailboxpanel');
    }

}
?>